import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:mtf/app/modules/cover_module/cover_controller.dart';
import 'package:mtf/app/theme/app_colors.dart';
import 'package:mtf/app/theme/app_text_theme.dart';
import 'package:mtf/app/widget/AppBarLeftTitle.dart';
/**
 * GetX Template Generator - fb.com/htngu.99
 * */

class coverPage extends GetView<coverController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarLeftTitle(title: "划转"),
      body: Container(
        margin: EdgeInsets.all(10),
        child: ListView.builder(
          shrinkWrap: true,
          itemBuilder: (context, index) {
            if (index == 0) {
              return Container(
                margin: EdgeInsets.symmetric(vertical: 10),
                padding: EdgeInsets.all(10),
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(10)),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Flex(
                      direction: Axis.horizontal,
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text("转账账号",style: leftInputTextStyle,),
                        Expanded(
                          flex: 1,
                          child: TextField(
                            textAlign: TextAlign.right,
                            decoration: InputDecoration(
                              hintText: "请输入转账账号",
                              hintStyle:
                              TextStyle(fontSize: 14, color: c_bbbbbb),
                              border: InputBorder.none,),
                            style: TextStyle(color: c_333333, fontSize: 14),
                            controller: controller.numController,
                          ),
                        )
                      ],
                    ),
                    Divider(height: 1,),
                    SizedBox(height: 25,),
                    Text(
                      "转账金额",
                      style: TextStyle(color: c_333333, fontSize: 15),
                    ),
                    Container(
                      width: double.infinity,
                      child: TextField(
                        decoration: InputDecoration(
                            hintText: "请输入提款金额",
                            hintStyle: TextStyle(color: c_bbbbbb, fontSize: 18),
                            suffixIcon: Container(
                              width: 40,
                              child: Text("USD"),
                              alignment: Alignment.center,
                            ),
                            enabledBorder: UnderlineInputBorder(
                                borderSide:
                                BorderSide(color: c_bbbbbb, width: 1.0))),
                      ),
                    ),
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 10),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text.rich(TextSpan(children: [
                            TextSpan(
                                text: "可提款余额",
                                style:
                                TextStyle(color: c_999999, fontSize: 12)),
                            TextSpan(
                                text: " 471670.0010USD",
                                style: TextStyle(
                                    color: c_f12f38,
                                    fontSize: 12,
                                    fontWeight: FontWeight.bold))
                          ])),
                          Text(
                            "全部使用",
                            style: TextStyle(
                                color: c_326BF9, fontWeight: FontWeight.bold),
                          )
                        ],
                      ),
                    ),
                    Padding(
                      padding: const EdgeInsets.symmetric(vertical: 10),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            "到账金额",
                            style: TextStyle(
                                color: c_333333,
                                fontSize: 15,
                                fontWeight: FontWeight.w500),
                          ),
                          Text(
                            "0",
                            style: TextStyle(
                                color: c_333333,
                                fontSize: 24,
                                fontWeight: FontWeight.w500),
                          )
                        ],
                      ),
                    )
                    // SettingBar(
                    //   leftIcon: Text(
                    //     "可提款余额",
                    //     style: TextStyle(color: c_999999, fontSize: 12,height: 1.1),
                    //   ),
                    //   leftText: "5542256",
                    //   leftTextSize: 12,
                    // )
                  ],
                ),
              );
            } else {
              return Container(
                margin: const EdgeInsets.only(top: 30, left: 10, right: 10),
                width: double.maxFinite,
                height: 48,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(24),
                  color: c_f12f38,
                ),
                child: TextButton(
                    child: Text("提交",
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: 16,
                            fontWeight: FontWeight.bold)),
                    onPressed: () {
                      controller.clickSub();
                    }),
              );
            }
          },
          itemCount: 2,
        ),
      ),
    );
  }
}
